<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<div class="bjui-pageContent" style="top: 0px; bottom: 32px;">
    <form id="thirdApi_save_form_id" method="post" action="/admin/thirdApi/save">
        <div class="bjui-row col-2">
            <input type="hidden" name="id" value="${saveThirdApi.id}">
            <input type="hidden" name="used" value="${saveThirdApi.used}">
            <p>
                <label class="row-label">配置名称</label>
                <span class="datagrid-dialog-column-span">
                    <input type="text" name="name" value="${saveThirdApi.name}" data-rule="required">
                </span>
            </p>

            <p>
                <label class="row-label">标识</label>
                <span class="datagrid-dialog-column-span">
                    <input type="text" name="nid" value="${saveThirdApi.nid}" data-rule="required">
                </span>
            </p>

            <p>
                <label class="row-label">配置值</label>
                <span class="datagrid-dialog-column-span">
                    <input type="text" name="value" value="${saveThirdApi.value}" data-rule="required">
                </span>
            </p>

            <p>
                <label class="row-label">说明</label>
                <span class="datagrid-dialog-column-span">
                    <textarea  name="remark" data-rule="required">${saveThirdApi.remark}</textarea>
                </span>
            </p>

            <label class="row-label">状态</label>
            <div class="row-input">
                <select data-toggle="status" name="status">
                    <option value="true" <c:if test="${empty saveThirdApi.status || saveThirdApi.status}">selected ="selected"</c:if> >开启</option>
                    <option value="false" <c:if test="${!empty saveThirdApi.status  && !saveThirdApi.status}">selected ="selected"</c:if> >关闭</option>
                </select>
            </div>

        </div>
    </form>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li>
            <button type="button" class="btn btn-red cancel" onclick="BJUI.dialog('closeCurrent');" data-icon="remove">
                <i class="fa fa-remove"></i> 取消
            </button>
        </li>
        <li>
            <button type="button" class="btn btn-default save" onclick="thirdApiSave();" data-icon="save"><i class="fa fa-save"></i> 保存</button>
        </li>
    </ul>
</div>
<script>

    /**
     * 提交保存信息
     */
    function thirdApiSave() {
        BJUI.ajax('ajaxform', {
            url: '/admin/thirdApi/save',
            form: $("#thirdApi_save_form_id"),
            validate: true,
            loadingmask: true,
            callback: function (response, options) {
                BJUI.dialog('closeCurrent');
                if (response.haveError) {
                    BJUI.alertmsg('error', response.errMsg, {
                        okCall: function () {
                            BJUI.navtab('refresh')
                        }
                    });

                } else {
                    BJUI.alertmsg('ok', response.data, {
                        okCall: function () {
                            BJUI.navtab('refresh')
                        }
                    });
                }
            }
        });
    }
</script>